package models;

import play.db.jpa.Model;

/**
 * Class.java is a class for...
 *
 * @author finni
 * @version 1.0
 *          Created 22.11.2011 13:42
 */
public class Board extends Model
{
    char boxes[] = new char[9];
    char countMarks;

    public Board()
    {
        initBoard();
    }

    public char[] getBoxes()
    {
        return boxes;
    }

    public void setBoxes(int i, char mark)
    {
        if (boxes[i] == '-')
        {
            boxes[i] = mark;
            countMarks++;
        }
    }

    public char getMark(int i)
    {
        return boxes[i];
    }

    public boolean isFull()
    {
        if ( (9 - countMarks) == 0 )
            return true;
        return false;
    }

    public void initBoard()
    {
       for (int i = 0; i < 9; i++)
            boxes[i] = '-';
       countMarks = 0;
    }

}
